-
-
Notifications
You must be signed in to change notification settings - Fork 46.6k
Improve validate solutions script & fix pre-commit error #3253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
dhruvmanila
merged 5 commits into
TheAlgorithms:master
from
dhruvmanila:improve-validate-solutions
Oct 13, 2020
Merged
Improve validate solutions script & fix pre-commit error #3253
dhruvmanila
merged 5 commits into
TheAlgorithms:master
from
dhruvmanila:improve-validate-solutions
Oct 13, 2020
+769
−2,944
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Use pytest fixture along with --capture=no flag to print out the top DURATIONS slowest solution at the end of the test sessions. - Remove the print part and try ... except ... block from the test function.
Completely changed the way I was performing the tests. Instead of parametrizing the problem numbers and expected output, I will parametrize the solution file path. Steps: - Collect all the solution file paths - Convert the paths into a Python module - Call solution on the module - Assert the answer with the expected results For assertion, it was needed to convert the JSON list object to Python dictionary object which required changing the JSON file itself.
cclauss
approved these changes
Oct 13, 2020
Wow, thanks for such a quick response! |
This is great work! |
5 tasks
stokhos
pushed a commit
to stokhos/Python
that referenced
this pull request
Jan 3, 2021
…ms#3253) * Trying to time every solution * Proposal 2 for timing PE solutions: - Use pytest fixture along with --capture=no flag to print out the top DURATIONS slowest solution at the end of the test sessions. - Remove the print part and try ... except ... block from the test function. * Proposal 3 for timing PE solutions: Completely changed the way I was performing the tests. Instead of parametrizing the problem numbers and expected output, I will parametrize the solution file path. Steps: - Collect all the solution file paths - Convert the paths into a Python module - Call solution on the module - Assert the answer with the expected results For assertion, it was needed to convert the JSON list object to Python dictionary object which required changing the JSON file itself. * Add type hints for variables * Fix whitespace in single_qubit_measure
Panquesito7
pushed a commit
to Panquesito7/Python
that referenced
this pull request
May 13, 2021
…ms#3253) * Trying to time every solution * Proposal 2 for timing PE solutions: - Use pytest fixture along with --capture=no flag to print out the top DURATIONS slowest solution at the end of the test sessions. - Remove the print part and try ... except ... block from the test function. * Proposal 3 for timing PE solutions: Completely changed the way I was performing the tests. Instead of parametrizing the problem numbers and expected output, I will parametrize the solution file path. Steps: - Collect all the solution file paths - Convert the paths into a Python module - Call solution on the module - Assert the answer with the expected results For assertion, it was needed to convert the JSON list object to Python dictionary object which required changing the JSON file itself. * Add type hints for variables * Fix whitespace in single_qubit_measure
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reason:
I wanted to add the ability to log the time it took for each solution. It started by adding this functionality to the existing script but that got quite cumbersome as you can see in my previous commit on this branch. Then I got an aha moment to change the way I am testing the solution which leads me to this PR.
Describe your change:
I have completely changed the way I was performing the tests. Instead of parameterizing the problem numbers and expected output, I will parametrize the solution file path. This way we won't need the
subtests
dependency. This also means that we are only testing the files present in the directory and no need to skip for solutions not submitted. Now, we can also look at the time it takes for each solution with the help of the--durations
flag frompytest
.Steps:
For getting the expected value, it was needed to convert the JSON list object to a Python dictionary object
which required changing the JSON file itself.
Checklist: